import request from '@/utils/request2'


export interface ListParams {
  current: Number, // 当前页
  size: Number, // 每页的数
  params?: Object // json对象
}

export interface Id {
  id: Number
}

export interface Teacher {
  params: Object
}

export function getList({ current, size, params }: ListParams) {
  console.log("请求参数", params)
  return request({
    url: `/eduservice/teacher/findCondition/${current}/${size}`,
    method: 'post',
    data: params // data代表把对象转换为json传递到接口里
  })
}

export function deleteById({ id }: Id) {
  return request({
    url: `/eduservice/teacher/delete/${id}`,
    method: 'delete'
  })
}

export function addTeacher({ params }: Teacher) {
  return request({
    url: `/eduservice/teacher/add`,
    method: 'post',
    data: params
  })
}

export function getInfoById({ id }: Id) {
  return request({
    url: `/eduservice/teacher/find/${id}`,
    method: 'get',
  })
}

export function updateTeacher({ params }: Teacher) {
  return request({
    url: `/eduservice/teacher/update`,
    method: 'post',
    data: params
  })
}

export function getCourseList() {
  return request({
    url: `/eduservice/subject/getAllSubject`,
    method: 'get',
  })
}